package com.hhit.bigscreenbackmanage.service.impl.jdgl;


import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.controller.jdgl.JdglImportController;
import com.hhit.bigscreenbackmanage.dao.jdgl.TJdglDwjsjdjhDao;
import com.hhit.bigscreenbackmanage.entity.jdgl.*;
import com.hhit.bigscreenbackmanage.entity.jjgl.TJjglCspsyb;
import com.hhit.bigscreenbackmanage.entity.jjgl.TJjglGdsnmggz;
import com.hhit.bigscreenbackmanage.entity.jjgl.TJjglSgtYsglssqkyb;
import com.hhit.bigscreenbackmanage.service.jdgl.TJdglDwjsjdjhService;
import com.hhit.bigscreenbackmanage.util.PageUtil;
import com.hhit.bigscreenbackmanage.util.Utils;
import com.hhit.bigscreenbackmanage.vo.jdgl.NdjhVo;
import com.hhit.bigscreenbackmanage.vo.jdgl.UpcomingVO;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 电网建设进度计划(TJdglDwjsjdjh)表服务实现类
 *
 * @author makejava
 * @since 2021-07-20 20:52:30
 */
@Service("tJdglDwjsjdjhService")
public class TJdglDwjsjdjhServiceImpl implements TJdglDwjsjdjhService {

    private static Logger log = LoggerFactory.getLogger(TJdglDwjsjdjhServiceImpl.class);

    // 已上报物资台账超期
    final static String YSBWZTZ_CQ = "YSBWZTZ_CQ";

    // 已上报物资台账延期
    final static String YSBWZTZ_YQ = "YSBWZTZ_YQ";

    // 数量错误
    final static String WZSBQKFX_NUMERROR = "WZSBQKFX_NUMERROR";

    // 未上报
    final static String WZSBQKFX_NOTREPORT = "WZSBQKFX_NOTREPORT";

    // 单位有误
    final static String WZSBQKFX_UNITERROR = "WZSBQKFX_UNITERROR";

    // 扩展编码有误
    final static String WZSBQKFX_EXPANDNUMERROR = "WZSBQKFX_EXPANDNUMERROR";

    /**
     * 进度滞后
     **/
    final static String LAGGING_PROGRESS = "LAGGING_PROGRESS";


    @Resource
    private TJdglDwjsjdjhDao tJdglDwjsjdjhDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public TJdglDwjsjdjh queryById(String id) {
        return this.tJdglDwjsjdjhDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TJdglDwjsjdjh> queryAllByLimit(int offset, int limit) {
        return this.tJdglDwjsjdjhDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tJdglDwjsjdjh 实例对象
     * @return 实例对象
     */
    @Override
    public TJdglDwjsjdjh insert(TJdglDwjsjdjh tJdglDwjsjdjh) {
        this.tJdglDwjsjdjhDao.insert(tJdglDwjsjdjh);
        return tJdglDwjsjdjh;
    }

    /**
     * 修改数据
     *
     * @param tJdglDwjsjdjh 实例对象
     * @return 实例对象
     */
    @Override
    public TJdglDwjsjdjh update(TJdglDwjsjdjh tJdglDwjsjdjh) {
        this.tJdglDwjsjdjhDao.update(tJdglDwjsjdjh);
        return this.queryById(tJdglDwjsjdjh.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.tJdglDwjsjdjhDao.deleteById(id) > 0;
    }

    @Override
    public Map<String, Object> importDwjsjdjh(String propName, MultipartFile[] files, String dataTime) {
        log.info("start to importDwjsjdjh");
        Map<String,Object> resultMap = new HashMap<>();
        boolean flag = false;
        try {
            List<Map<String,Object>> result = Utils.getExcelData(propName,files);
            if(result.size() > 0 ){
                //将Map转为Bean
                List<TJdglDwjsjdjh> list = (List<TJdglDwjsjdjh>)Utils.mapToEntiry(result, TJdglDwjsjdjh.class);
                if(list.size() > 0 ){
                    //处理UUID
                    list.forEach(item->{
                        item.setId(IdUtil.fastSimpleUUID());
                        item.setDataTime(dataTime);
                    });
                    log.info("list is ", list);
                    int count =  tJdglDwjsjdjhDao.importDwjsjdjh(list);
                    if(count > 0){
                        flag = true;
                    }
                }
            }
            resultMap.put("flag",flag);
        }catch (Exception e) {
            resultMap.put("flag",false);
            e.printStackTrace();
        }
        log.info("resultMap is ", resultMap);
        return resultMap;
    }

    @Override
    public Map<String, Object> importNmggz(String propName, MultipartFile[] files, String dataTime) {
        log.info("start to importNmggz");
        Map<String,Object> resultMap = new HashMap<>();
        boolean flag = false;
        try {
            List<Map<String,Object>> result = Utils.getExcelData(propName,files);
            if(result.size() > 0 ){
                //将Map转为Bean
                List<TJjglGdsnmggz> list = (List<TJjglGdsnmggz>)Utils.mapToEntiry(result, TJjglGdsnmggz.class);
                if(list.size() > 0 ){
                    //处理UUID
                    list.forEach(item->{
                        item.setId(IdUtil.fastSimpleUUID());
                        item.setDataTime(dataTime);
                    });
                    log.info("list is ", list);
                    // 删除相同月份数据
                    tJdglDwjsjdjhDao.deleteNmggz(dataTime);
                    int count =  tJdglDwjsjdjhDao.importNmggz(list);
                    if(count > 0){
                        flag = true;
                    }
                }
            }
            resultMap.put("flag",flag);
        }catch (Exception e) {
            resultMap.put("flag",false);
            e.printStackTrace();
        }
        log.info("resultMap is ", resultMap);
        return resultMap;
    }

    @Override
    public Map<String, Object> importCcgq(String propName, MultipartFile[] files) {
        log.info("start to importCcgq");
        Map<String,Object> resultMap = new HashMap<>();
        boolean flag = false;
        try {
            List<Map<String,Object>> result = Utils.getExcelData(propName,files);
            if(result.size() > 0 ){
                //将Map转为Bean
                List<TJdglCcgq> list = (List<TJdglCcgq>)Utils.mapToEntiry(result, TJdglCcgq.class);
                if(list.size() > 0 ){
                    //处理UUID
                    list.forEach(item->{
                        item.setId(IdUtil.fastSimpleUUID());
                    });
                    log.info("list is ", list);
                    //数据清空
                    tJdglDwjsjdjhDao.deleteCcgq();
                    int count =  tJdglDwjsjdjhDao.importCcgq(list);
                    if(count > 0){
                        flag = true;
                    }
                }
            }
            resultMap.put("flag",flag);
        }catch (Exception e) {
            resultMap.put("flag",false);
            e.printStackTrace();
        }
        log.info("resultMap is ", resultMap);
        return resultMap;
    }

    @Override
    public Map<String, Object> queryCcgq(JSONObject jsonObject) {
        log.info("start to queryCcgq is ", jsonObject);
        Map<String,Object> out = new HashMap<>();
        PageUtil page = new PageUtil();
        String pageSize = jsonObject.get("pageSize").toString();
        String pageNo = jsonObject.get("pageNo").toString();
        int count = tJdglDwjsjdjhDao.queryCcgqCount(jsonObject);
        page.pageCount=Integer.parseInt(pageSize);// 每页数
        page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
        jsonObject.put("rowNum",page.getRowNum());
        jsonObject.put("pageCount",page.getPageCount());
        List<TJdglCcgq> tJdglCcgqs = tJdglDwjsjdjhDao.queryCcgq(jsonObject);
        out.put("page",page);
        out.put("list",tJdglCcgqs);
        return out;
    }

    @Override
    public Map<String, Object> queryNdjh(JSONObject jsonObject) {
        log.info("start to queryNdjh is ", jsonObject);
        Map<String,Object> out = new HashMap<>();
        PageUtil page = new PageUtil();
        String pageSize = jsonObject.get("pageSize").toString();
        String pageNo = jsonObject.get("pageNo").toString();
        int count = tJdglDwjsjdjhDao.queryNdjhCount(jsonObject);
        page.pageCount=Integer.parseInt(pageSize);// 每页数
        page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
        jsonObject.put("rowNum",page.getRowNum());
        jsonObject.put("pageCount",page.getPageCount());
        List<NdjhVo> ndjhVos = tJdglDwjsjdjhDao.queryNdjh(jsonObject);
        if (!CollectionUtils.isEmpty(ndjhVos)) {
            List<String> xmbms = ndjhVos.stream().map(NdjhVo::getXmbm).collect(Collectors.toList());
            List<Ndjh> ndjhDxgcs = tJdglDwjsjdjhDao.queryNdjhDxgc(xmbms);
            if (!CollectionUtils.isEmpty(ndjhDxgcs)) {
                Map<String, List<Ndjh>> listmap = ndjhDxgcs.stream().collect(Collectors.groupingBy(Ndjh::getXmbm));
                ndjhVos.forEach(item -> item.setNdjhDxgc(listmap.get(item.getXmbm())));
            }
        }
        out.put("list", ndjhVos);
        out.put("page", page);;
        return out;
    }

    @Override
    public Map<String, Object> queryDwjsjdjh(JSONObject jsonObject) {
        log.info("start to queryDwjsjdjh is ", jsonObject);
        Map<String,Object> out = new HashMap<>();
        PageUtil page = new PageUtil();
        String pageSize = jsonObject.get("pageSize").toString();
        String pageNo = jsonObject.get("pageNo").toString();
        int count = tJdglDwjsjdjhDao.queryDwjsjdjhCount(jsonObject);
        page.pageCount=Integer.parseInt(pageSize);// 每页数
        page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
        jsonObject.put("rowNum",page.getRowNum());
        jsonObject.put("pageCount",page.getPageCount());
        List<TJdglDwjsjdjh> tJdglDwjsjdjhs = tJdglDwjsjdjhDao.queryDwjsjdjh(jsonObject);
        out.put("page",page);
        out.put("list",tJdglDwjsjdjhs);
        return out;
    }

    @Override
    public Map<String, Object> queryGdsnmggz(JSONObject jsonObject) {
        log.info("start to queryGdsnmggz is ", jsonObject);
        Map<String,Object> out = new HashMap<>();
        PageUtil page = new PageUtil();
        String pageSize = jsonObject.get("pageSize").toString();
        String pageNo = jsonObject.get("pageNo").toString();
        int count = tJdglDwjsjdjhDao.queryGdsnmggzCount(jsonObject);
        page.pageCount=Integer.parseInt(pageSize);// 每页数
        page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
        jsonObject.put("rowNum",page.getRowNum());
        jsonObject.put("pageCount",page.getPageCount());
        List<TJjglGdsnmggz> tJjglGdsnmggzs = tJdglDwjsjdjhDao.queryGdsnmggz(jsonObject);
        out.put("page",page);
        out.put("list",tJjglGdsnmggzs);
        return out;
    }

    @Override
    public Map<String, Object> queryKgTcSbdCount() {
        log.info("start to queryKgTcSbdCount ");
        Map<String, Object> outBean = new HashMap<>();
        List<Map<String, Object>> ndjdjhasltj = tJdglDwjsjdjhDao.queryKgTcSbdCount();
        String kgsl = "0";
        String tcsl = "0";
        if(!CollectionUtils.isEmpty(ndjdjhasltj)){
            kgsl = ndjdjhasltj.get(0).get("kgsl") == null ? "0" : ndjdjhasltj.get(0).get("kgsl").toString();
            tcsl = ndjdjhasltj.get(0).get("tcsl") == null ? "0" : ndjdjhasltj.get(0).get("tcsl").toString();
        }
        outBean.put("kgsl",kgsl);
        outBean.put("tcsl",tcsl);
        return outBean;
    }

    @Override
    public Map<String, Object> queryKgTcSbdXq(JSONObject jsonObject) {
        log.info("start to queryKgTcSbdXq is {}", jsonObject);
        String type = jsonObject.getString("type");
        String pageSize = jsonObject.get("pageSize").toString();
        String pageNo = jsonObject.get("pageNo").toString();

        Map<String, Object> outBean = new HashMap<>();
        PageUtil page = new PageUtil();
        int count = 0;
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.queryKgTcSbdCount();
        if (!CollectionUtils.isEmpty(list)) {
            if (type.equals("kg")) {
                count = Integer.parseInt(list.get(0).get("kgsl").toString());
            }
            if (type.equals("tc")) {
                count = Integer.parseInt(list.get(0).get("tcsl").toString());
            }
        }
        page.pageCount=Integer.parseInt(pageSize);// 每页数
        page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
        jsonObject.put("rowNum",page.getRowNum());
        jsonObject.put("pageCount",page.getPageCount());

        List<TjdglNdjh> ndjhs = tJdglDwjsjdjhDao.queryKgTcSbdXq(jsonObject);
        outBean.put("page", page);
        outBean.put("list", ndjhs);
        return outBean;
    }

    @Override
    public Map<String, Object> queryLastMonthBd() {
        log.info("start to queryLastMonthKgTc is {}");
        Map<String, Object> outBean = new HashMap<>();
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.queryLastMonthBd();
        String kgndlj = "0";
        String dykg = "0";
        String tcndlj = "0";
        String dytc = "0";
        if(!CollectionUtils.isEmpty(list)){
            kgndlj = list.get(0).get("kgndlj") == null ? "0" : list.get(0).get("kgndlj").toString();
            dykg = list.get(0).get("dykg") == null ? "0" : list.get(0).get("dykg").toString();
            tcndlj = list.get(0).get("tcndlj") == null ? "0" : list.get(0).get("tcndlj").toString();
            dytc = list.get(0).get("dytc") == null ? "0" : list.get(0).get("dytc").toString();
        }
        outBean.put("kgndlj",kgndlj);
        outBean.put("dykg",dykg);
        outBean.put("tcndlj",tcndlj);
        outBean.put("dytc",dytc);
        return outBean;
    }

    @Override
    public Map<String, Object> queryLastMonthXl() {
        log.info("start to queryLastMonthKgTc is {}");
        Map<String, Object> outBean = new HashMap<>();
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.queryLastMonthXl();
        String kgndlj = "0";
        String dykg = "0";
        String tcndlj = "0";
        String dytc = "0";
        if(!CollectionUtils.isEmpty(list)){
            kgndlj = list.get(0).get("kgndlj") == null ? "0" : list.get(0).get("kgndlj").toString();
            dykg = list.get(0).get("dykg") == null ? "0" : list.get(0).get("dykg").toString();
            tcndlj = list.get(0).get("tcndlj") == null ? "0" : list.get(0).get("tcndlj").toString();
            dytc = list.get(0).get("dytc") == null ? "0" : list.get(0).get("dytc").toString();
        }
        outBean.put("kgndlj",kgndlj);
        outBean.put("dykg",dykg);
        outBean.put("tcndlj",tcndlj);
        outBean.put("dytc",dytc);
        return outBean;
    }

    @Override
    public Map<String, Object> queryCurrentMonthKgTc() {
        log.info("start to queryLastMonthKgTc is {}");
        Map<String, Object> outBean = new HashMap<>();
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.queryCurrentMonthKgTc();
        String bdndkglj = "0";
        String bdjhkg = "0";
        String bdndtclj = "0";
        String bdjhtc = "0";
        String xlndkglj = "0";
        String xljhkg = "0";
        String xlndtclj = "0";
        String xljhtc = "0";
        if(!CollectionUtils.isEmpty(list)){
            bdndkglj = list.get(0).get("bdndkglj") == null ? "0" : list.get(0).get("bdndkglj").toString();
            bdjhkg = list.get(0).get("bdjhkg") == null ? "0" : list.get(0).get("bdjhkg").toString();
            bdndtclj = list.get(0).get("bdndtclj") == null ? "0" : list.get(0).get("bdndtclj").toString();
            bdjhtc = list.get(0).get("bdjhtc") == null ? "0" : list.get(0).get("bdjhtc").toString();
            xlndkglj = list.get(0).get("xlndkglj") == null ? "0" : list.get(0).get("xlndkglj").toString();
            xljhkg = list.get(0).get("xljhkg") == null ? "0" : list.get(0).get("xljhkg").toString();
            xlndtclj = list.get(0).get("xlndtclj") == null ? "0" : list.get(0).get("xlndtclj").toString();
            xljhtc = list.get(0).get("xljhtc") == null ? "0" : list.get(0).get("xljhtc").toString();
        }
        outBean.put("bdndkglj",bdndkglj);
        outBean.put("bdjhkg",bdjhkg);
        outBean.put("bdndtclj",bdndtclj);
        outBean.put("bdjhtc",bdjhtc);
        outBean.put("xlndkglj",xlndkglj);
        outBean.put("xljhkg",xljhkg);
        outBean.put("xlndtclj",xlndtclj);
        outBean.put("xljhtc",xljhtc);
        return outBean;
    }

    @Override
    public Map<String, Object> getProgressWarning(String modelType, String status, String cityCode, String pageSize, String pageNo) {
        Map<String,Object> outBean = new HashMap<>();
        List<UpcomingVO> list = new ArrayList<>();
        PageUtil page = new PageUtil();
        page.pageCount=Integer.parseInt(pageSize);// 每页数

        if("WZ".equals(modelType)){
            String[] YSBWZTZ = {YSBWZTZ_CQ,YSBWZTZ_YQ};
            String[] WZSBQKFX = {WZSBQKFX_NUMERROR,WZSBQKFX_NOTREPORT,WZSBQKFX_UNITERROR,WZSBQKFX_EXPANDNUMERROR};
            int count = tJdglDwjsjdjhDao.getProgressWarningByWzCount(status, cityCode,
                    YSBWZTZ,WZSBQKFX);
            page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
            List<UpcomingVO> upcomingVOS = tJdglDwjsjdjhDao.
                    getProgressWarningByWz(status, cityCode,
                            YSBWZTZ,WZSBQKFX,page);
            list.addAll(upcomingVOS);

        }
        // 进度预警
        if("JDYJ".equals(modelType)){
            int count = tJdglDwjsjdjhDao.getProgressWarningByJdCount(
                    status, cityCode,LAGGING_PROGRESS);
            page.init(count,Integer.parseInt(pageNo));//参数1：总行数，参数2：当前页
            List<UpcomingVO> upcomingVOS = tJdglDwjsjdjhDao
                    .getProgressWarningByJd(status, cityCode,LAGGING_PROGRESS,page);
            list.addAll(upcomingVOS);
        }

        outBean.put("list",list);
        outBean.put("page",page);
        return outBean;
    }

    @Override
    public Map<String, Object> getWarningTotal(String cityCode,  String modelType) {
        Map<String,Object> outBean = new HashMap<>();
        List<String> status = new ArrayList<>();
        status.add("0");
        status.add("1");
        status.add("2");
        status.add("3");

        int[] JdList = {0,0,0,0};
        int[] WzList = {0,0,0,0};

        //物资预警
        if("WZ".equals(modelType)){
            String[] YSBWZTZ = {YSBWZTZ_CQ,YSBWZTZ_YQ};
            String[] WZSBQKFX = {WZSBQKFX_NUMERROR,WZSBQKFX_NOTREPORT,WZSBQKFX_UNITERROR,WZSBQKFX_EXPANDNUMERROR};
            for (int i = 0; i < status.size(); i++) {
                int count = tJdglDwjsjdjhDao.getProgressWarningByWzCount(status.get(i), cityCode,
                        YSBWZTZ,WZSBQKFX);
                WzList[i] = count;
            }
        }
        // 进度预警
        if("JDYJ".equals(modelType)){
            for (int i = 0; i < status.size(); i++) {
                int count = tJdglDwjsjdjhDao.getProgressWarningByJdCount(
                        status.get(i), cityCode,LAGGING_PROGRESS);
                JdList[i] = count;
            }
        }
        outBean.put("JdList",JdList);
        outBean.put("WzList",WzList);
        return outBean;
    }

    @Override
    public Map<String, Object> getMaterialReportingAnalysisCount(String cityCode) {
        Map<String,Object> outBean = new HashMap<>();
        List<String> status = new ArrayList<>();
        //已上报
        status.add("HASBEENREPORT");
        //未上报
        status.add("NOTREPORT");
        //单位有误
        status.add("UNITERROR");
        //数量有误
        status.add("NUMERROR");
        //扩展编码有误
        status.add("EXPANDNUMERROR");
        int count = 0;
        for (int i = 0; i < status.size(); i++) {
            count = tJdglDwjsjdjhDao.getMaterialReportingAnalysisCount(status.get(i), cityCode);
            outBean.put(status.get(i), count);
        }
        count = tJdglDwjsjdjhDao.getMaterialReportingAnalysisCount(null, cityCode);
        outBean.put("total", count);
        return outBean;
    }

    @Override
    public Map<String, Object> getZdgctj() {
        log.info("start to getZdgctj is ");
        Map<String, Object> outBean = new HashMap<>();
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.getZdgctj();
        String tgykg = "0";
        String tgytc = "0";
        String yxkg = "0";
        String yxtc = "0";
        String dtkg = "0";
        String dttc = "0";
        String xnykg = "0";
        String xnytc = "0";
        String wbkvkg = "0";
        String wbkvtc = "0";
        String ywptkg = "0";
        String ywpttc = "0";
        String hsfnkg = "0";
        String hsfntc = "0";
        if(!CollectionUtils.isEmpty(list)){
            tgykg = list.get(0).get("tgykg") == null ? "0" : list.get(0).get("tgykg").toString();
            tgytc = list.get(0).get("tgytc") == null ? "0" : list.get(0).get("tgytc").toString();
            yxkg = list.get(0).get("yxkg") == null ? "0" : list.get(0).get("yxkg").toString();
            yxtc = list.get(0).get("yxtc") == null ? "0" : list.get(0).get("yxtc").toString();
            dtkg = list.get(0).get("dtkg") == null ? "0" : list.get(0).get("dtkg").toString();
            dttc = list.get(0).get("dttc") == null ? "0" : list.get(0).get("dttc").toString();
            xnykg = list.get(0).get("xnykg") == null ? "0" : list.get(0).get("xnykg").toString();
            xnytc = list.get(0).get("xnytc") == null ? "0" : list.get(0).get("xnytc").toString();
            wbkvkg = list.get(0).get("wbkvkg") == null ? "0" : list.get(0).get("wbkvkg").toString();
            wbkvtc = list.get(0).get("wbkvtc") == null ? "0" : list.get(0).get("wbkvtc").toString();
            ywptkg = list.get(0).get("ywptkg") == null ? "0" : list.get(0).get("ywptkg").toString();
            ywpttc = list.get(0).get("ywpttc") == null ? "0" : list.get(0).get("ywpttc").toString();
            hsfnkg = list.get(0).get("hsfnkg") == null ? "0" : list.get(0).get("hsfnkg").toString();
            hsfntc = list.get(0).get("hsfntc") == null ? "0" : list.get(0).get("hsfntc").toString();
        }
        outBean.put("tgykg",tgykg);
        outBean.put("tgytc",tgytc);
        outBean.put("yxkg",yxkg);
        outBean.put("yxtc",yxtc);
        outBean.put("dtkg",dtkg);
        outBean.put("dttc",dttc);
        outBean.put("xnykg",xnykg);
        outBean.put("xnytc",xnytc);
        outBean.put("wbkvkg",wbkvkg);
        outBean.put("wbkvtc",wbkvtc);
        outBean.put("ywptkg",ywptkg);
        outBean.put("ywpttc",ywpttc);
        outBean.put("hsfnkg",hsfnkg);
        outBean.put("hsfntc",hsfntc);
        return outBean;
    }

    @Override
    public Map<String, Object> queryCcgqTj() {
        Map<String, Object> out = new HashMap<>();
        List<String> list = new ArrayList<>();
        list.add("110");
        list.add("220");
        list.add("500");
        int count = 0;
        for(int i = 0; i < list.size(); i++) {
            count = tJdglDwjsjdjhDao.queryCcgqTj(list.get(i));
            out.put(list.get(i),count);
        }
        out.put("total", tJdglDwjsjdjhDao.queryCcgqTj(null));
        return out;
    }

    @Override
    public Map<String, Object> queryXyglgz() {
        Map<String, Object> out = new HashMap<>();
        List<TJdglXyglgz> tJdglXyglgzs = tJdglDwjsjdjhDao.queryXyglgz();
        out.put("list", tJdglXyglgzs);
        return out;
    }

    @Override
    public Map<String, Object> queryPowerCutPlan(String cityCode) {
        Map<String, Object> out = new HashMap<>();
        List<Map<String, Object>> list = tJdglDwjsjdjhDao.queryPowerCutPlan(cityCode);
        if (!CollectionUtils.isEmpty(list)) {
            out.put("list", list.get(0));
        } else {
            out.put("list", Collections.EMPTY_MAP);
        }
        return out;
    }
}